﻿using System;
using System.Collections.Generic;
using System.Text;
using Mmht.DB ;
using System.Data ;

namespace Mmht.BT
{
    public class AdminBT
    {
        AdminDB adm = new AdminDB();
        /// <summary>
        /// 根据id返回名称
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string FindbyId(int id)
        {
            DataTable dt = adm.FindbyId(id);
            string name = string.Empty;
            try
            {
                name = dt.Rows[0]["name"].ToString();
            }
            catch
            {
                name = "未知";
            }
            return name;
        }
        public DataTable Datarowbyid(int id) 
        {
            DataTable dt = adm.FindbyId(id);
            
                return dt;
            
        }
        public bool InsertAdmin(string name, string password, int created_by, string e_mail, string tel) 
        {
            return adm.InsertAdmin(name,password,created_by,e_mail,tel);
        }
        public DataTable FindbyName(string name) 
        {
            return adm.FindByName(name);
        }
        public DataTable SelectAdmin() 
        {
            return adm.SelectAdmin();
        }
        public bool DelAdmin(int id) 
        {
            return adm.DelAdmin(id);
        }
        public bool UpdateAdmin1(string e_mail,string tel,int id) 
        {
            return adm.UpdateAdmin1 (e_mail ,tel ,id);
        }
        public bool UpdateAdmin2(string password,string e_mail,string tel,int id) 
        {
            return adm.UpdateAdmin2(password ,e_mail ,tel ,id);
        }
    }
}
